home *** CD-ROM | disk | FTP | other *** search
/ Champak 123 / (Vol 123) Jan 13 2011.iso / Games / doraemon_fishing.swf / scripts / DefineSprite_5_bubble / frame_1 / DoAction.as
Text File  |  2011-01-13  |  847b  |  43 lines

  1. function randomNum(num)
  2. {
  3.    rndNum = Math.floor(Math.random() * num);
  4.    return rndNum;
  5. }
  6. function bubble()
  7. {
  8.    if(_Y > -128)
  9.    {
  10.       if(this._alpha < ThisSize * 0.8)
  11.       {
  12.          this._alpha += 5;
  13.       }
  14.       this._x += randomNum(2) - 1;
  15.       this._y -= ThisSize / 30;
  16.    }
  17.    else if(_Y > -138)
  18.    {
  19.       this._alpha -= 5;
  20.       this._x += randomNum(2) - 1;
  21.       this._y -= ThisSize / 30;
  22.    }
  23.    else
  24.    {
  25.       ThisSize = randomNum(50) + 50;
  26.       this._xscale = ThisSize;
  27.       this._yscale = ThisSize;
  28.       this._x = randomNum(300) - 150;
  29.       this._y = 130;
  30.       this._alpha = 0;
  31.    }
  32. }
  33. ThisSize = randomNum(50) + 50;
  34. this._xscale = ThisSize;
  35. this._yscale = ThisSize;
  36. this._x = randomNum(300) - 150;
  37. this._y = 130;
  38. this._alpha = 0;
  39. this.onEnterFrame = function()
  40. {
  41.    bubble();
  42. };
  43.